package com.mvu.banana.common;

import org.fest.assertions.ThrowableAssert;
import org.junit.Assert;

import static org.fest.assertions.Assertions.assertThat;

/**
 */
public abstract class AssertBlock {

  public abstract void run();

  public ThrowableAssert throwException(Class exceptionType) {
    try{
      run();
      Assert.fail("Expect exception to be thrown.");
    }catch (Throwable e){
      return assertThat(e)
              .as(e.toString())
              .isExactlyInstanceOf(exceptionType);
    }
    return null;
  }
}
